package facade;

import ejb.*;
import java.io.Serializable;
import java.util.*;

public class ProjetoFacade implements Serializable {
  private String id;
  private String gerenteId;
  private String clienteId;
  private int precoPorHora;
  private int cargaHorariaTotal;
  private int limiteCargaExtra;
  private int limiteCargaExtraPorFuncionario;
  private Vector cargaSemanalProjetoCollection;
  private Vector faturaCollection;
  private Vector funcionarioCollection;

  public ProjetoFacade(ProjetoLocal p) {
    id = p.getId();
    gerenteId = p.getIdGerente();
    if(p.getIdCliente() != null)
        clienteId = p.getIdCliente().getId();
    else clienteId = null;
    precoPorHora = p.getPrecoPorHora();
    cargaHorariaTotal = p.getCargaHorariaTotal();
    limiteCargaExtra = p.getLimiteCargaExtra();
    limiteCargaExtraPorFuncionario = p.getLimiteCargaExtraPorFuncionario();

    Vector v1 = new Vector();
    Collection c1 = p.getCargaSemanalProjetoCollection();
    for (Iterator it = c1.iterator(); it.hasNext();)
      v1.add(new CargaSemanalProjetoFacade((CargaSemanalProjetoLocal)it.next()));
    cargaSemanalProjetoCollection = v1;

    Vector v2 = new Vector();
    Collection c2 = p.getFaturaCollection();
    for (Iterator it = c2.iterator(); it.hasNext();)
      v2.add(new FaturaFacade((FaturaLocal)it.next()));
    faturaCollection = v2;

    Vector v3 = new Vector();
    Collection c3 = p.getFuncionarioCollection();
    for (Iterator it = c3.iterator(); it.hasNext();)
      v3.add(new FuncionarioFacade((FuncionarioLocal)it.next()));
    funcionarioCollection = v3;
  }

  public int getCargaHorariaTotal() {
    return cargaHorariaTotal;
  }

  public String getClienteId() {
    return clienteId;
  }

  public String getGerenteId() {
    return gerenteId;
  }

  public String getId() {
    return id;
  }

  public int getLimiteCargaExtra() {
    return limiteCargaExtra;
  }

  public int getLimiteCargaExtraPorFuncionario() {
    return limiteCargaExtraPorFuncionario;
  }

  public int getPrecoPorHora() {
    return precoPorHora;
  }

  public Vector getCargaSemanalProjetoCollection() {
    return cargaSemanalProjetoCollection;
  }

  public Vector getFaturaCollection() {
    return faturaCollection;
  }

  public Vector getFuncionarioCollection() {
    return funcionarioCollection;
  }
}
